package experiment1;


abstract class Animal
{
	abstract void cry();
	abstract String getAnimalName();
}


class Dog extends Animal
{
	String sound;
	void cry()
	{
		System.out.println("动物的声音：汪汪汪~");
	}
	String getAnimalName()
	{
		sound="小狗";
		return sound;
	}
}


class Cat extends Animal
{
	String sound;
	void cry()
	{
		System.out.println("动物的声音： 喵喵喵~");
	}
	String getAnimalName() 
	{
		sound="小狗";
		return sound;
	}
}


class Simulator
{
	void playSound(Animal animal)
	{
		animal.cry();
		animal.getAnimalName();
		System.out.println("动物种类的名称："+animal.getAnimalName());
	}
}


public class Application
{
	public static void main (String args[])
	{
		Simulator simulator=new Simulator();
		simulator.playSound(new Dog());
		simulator.playSound(new Cat());
	}
}
